package com.controller;

import com.pojo.ResponseResult;
import com.pojo.User;
import com.service.userService;
import lombok.AllArgsConstructor;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/lidongp")
public class userController {
    @Autowired
    @Qualifier("lidongpService")
    private userService lidongpService;


    List<User> list=null;

    @RequestMapping("/allUser")
    @ResponseBody
    private String queryALl(){
        list=lidongpService.queryAllUser();
        JSONObject json = new JSONObject();
        json.put("code",0);
        json.put("msg","数据加载成功");
        json.put("count",list.size());
        json.put("data",list);
        return json.toString();
    }

    public List<User> getList() {
        return list;
    }

    public void setList(List<User> list) {
        this.list = list;
    }
}
